package solutions.leetcode.easy

/**
 * @author lizhidong
 * <a href="https://leetcode.cn/problems/minimum-common-value/">2540. 最小公共值</a>
 */
private class Solution2540 {
    fun getCommon(nums1: IntArray, nums2: IntArray): Int {
        var p1 = 0
        var p2 = 0
        while (p1 < nums1.size && p2 < nums2.size) {
            if (nums1[p1] == nums2[p2]) {
                return nums1[p1]
            } else if (nums1[p1] < nums2[p2]) {
                p1++
            } else {
                p2++
            }
        }
        return -1
    }
}

fun main() {
    
}